<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>斐波那契数列第N项的值</title>
    <style>
            a:link,a:visited{
                color: #222;text-decoration: none;}
           a:hover{color: #fd4913;}
       </style>
   
</head>
<body>
    <h2>斐波那契数列第N项的值</h2>
    <script>
        function sion(n){
            if(n<0){
                return '输入的数字不能小于0';
            }else if(n==0){
                return 0;
            }else if(n==1){
                return 1;
            }else{
                return sion(n-1)+sion(n-2);
            }
        }
        var x=prompt("输入值：");
        document.write(sion(x));
    </script>
    
</body>
</html>